package PTA.MainXDX.ex02;

import java.util.Scanner;
class Person{
private String name;
private boolean gender;
private int age;
private int id;
private static int a=0;
static{
    System.out.println("This is static initialization block");

}
    {
        System.out.println("This is initialization block, id is "+a);

    }
    public Person() {
        System.out.println("This is constructor");
this.id=a;
        System.out.println(this.name+","+this.age+","+this.gender+","+this.id);
        System.out.println("Person [name="+this.name+", age="+this.age+", gender="+this.gender+", id="+this.id+"]");
    }

    public Person(String name, boolean gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.id = a;
        a++;
    }

    @Override
    public String toString() {
        System.out.println("Person [name="+this.name+", age="+this.age+", gender="+this.gender+", id="+this.id+"]");
return "1";
    }
}




public class ex02 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Person p[] = new Person[n];
for(int i=0;i<p.length;i++){
    String name = sc.next();
    int age = sc.nextInt();
    boolean gender = sc.nextBoolean();
    p[i] = new Person(name,gender,age);
}
for(int i=p.length-1;i>=0;i--){
    p[i].toString();
}
Person s=  new Person();

    }
}
